﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ServiceStack.ServiceInterface;
using ServiceStack.Common.Web;
using MMM.Services.Base;
using ServiceStack.ServiceHost;
using MMM.Services.Type;
using MMM.Services.Response;
using MMM.Core;

namespace MMM.Services
{
    [Serializable]
    public class MenuService : BaseService<MenuInfo, String>
    {
        public override object OnGet(MenuInfo request)
        {
            
            return Rep.GetAll(t => t.MenuClass == request.MenuClass).OrderBy(t => t.Index);
            //var node = new modelNode { Text = "", id = Guid.NewGuid().ToString(), Leaf = false };
            //addNode(node, 3);
            //return node;
        }

        protected override string getNewID()
        {
            return Guid.NewGuid().ToString();
        }

        protected override bool IdIsNull(string id)
        {
            return string.IsNullOrWhiteSpace(id);
        }

        protected override object GetIdValue(string id)
        {
            return id;
        }
    }




    //public class modelNode : JsonNode<modelNode>
    //{
    //    /// <summary>
    //    /// 名称
    //    /// </summary>
    //    public string Name { get; set; }
    //    /// <summary>
    //    /// 模块ID
    //    /// </summary>
    //    public string ModuleID { get; set; }
    //    /// <summary>
    //    /// 链接地址
    //    /// </summary>
    //    public string Url { get; set; }
    //    /// <summary>
    //    /// 图标
    //    /// </summary>
    //    public string Image { get; set; }
    //    /// <summary>
    //    /// 权限
    //    /// </summary>
    //    public int Value { get; set; }
    //}

}